package net.borderwars.util;

import org.hibernate.*;
import org.hibernate.stat.SessionStatistics;

import java.io.Serializable;
import java.sql.Connection;

/**
 * @author ehubbard
 *         Date: May 11, 2006
 *         Time: 1:46:24 PM
 */
public class DBSession {
    private Session sess;
    Transaction trans = null;

    public DBSession (Session sess) {
        this.sess = sess;
        trans = sess.beginTransaction ();
    }

    public EntityMode getEntityMode () {
        return sess.getEntityMode ();
    }

    public void flush () throws HibernateException {
        sess.flush ();
    }

    public void setFlushMode (final FlushMode flushMode) {
        sess.setFlushMode (flushMode);
    }

    public FlushMode getFlushMode () {
        return sess.getFlushMode ();
    }

    public void setCacheMode (final CacheMode cacheMode) {
        sess.setCacheMode (cacheMode);
    }

    public CacheMode getCacheMode () {
        return sess.getCacheMode ();
    }

    public SessionFactory getSessionFactory () {
        return sess.getSessionFactory ();
    }

    public Connection connection () throws HibernateException {
        return sess.connection ();
    }

    public Connection close () throws HibernateException {
        trans.commit ();
        return sess.close ();
    }

    public void cancelQuery () throws HibernateException {
        sess.cancelQuery ();
    }

    public boolean isOpen () {
        return sess.isOpen ();
    }

    public boolean isConnected () {
        return sess.isConnected ();
    }

    public boolean isDirty () throws HibernateException {
        return sess.isDirty ();
    }

    public Serializable getIdentifier (final Object o) throws HibernateException {
        return sess.getIdentifier (o);
    }

    public boolean contains (final Object o) {
        return sess.contains (o);
    }

    public void evict (final Object o) throws HibernateException {
        sess.evict (o);
    }

    public Object load (final Class aClass, final Serializable serializable, final LockMode lockMode) throws HibernateException {
        return sess.load (aClass, serializable, lockMode);
    }

    public Object load (final String s, final Serializable serializable, final LockMode lockMode) throws HibernateException {
        return sess.load (s, serializable, lockMode);
    }

    public Object load (final Class aClass, final Serializable serializable) throws HibernateException {
        return sess.load (aClass, serializable);
    }

    public Object load (final String s, final Serializable serializable) throws HibernateException {
        return sess.load (s, serializable);
    }

    public void load (final Object o, final Serializable serializable) throws HibernateException {
        sess.load (o, serializable);
    }

    public void replicate (final Object o, final ReplicationMode replicationMode) throws HibernateException {
        sess.replicate (o, replicationMode);
    }

    public void replicate (final String s, final Object o, final ReplicationMode replicationMode) throws HibernateException {
        sess.replicate (s, o, replicationMode);
    }

    public Serializable save (final Object o) throws HibernateException {
        return sess.save (o);
    }

    public Serializable save (final String s, final Object o) throws HibernateException {
        return sess.save (s, o);
    }

    public void saveOrUpdate (final Object o) throws HibernateException {
        sess.saveOrUpdate (o);
    }

    public void saveOrUpdate (final String s, final Object o) throws HibernateException {
        sess.saveOrUpdate (s, o);
    }

    public void update (final Object o) throws HibernateException {
        sess.update (o);
    }

    public void update (final String s, final Object o) throws HibernateException {
        sess.update (s, o);
    }

    public Object merge (final Object o) throws HibernateException {
        return sess.merge (o);
    }

    public Object merge (final String s, final Object o) throws HibernateException {
        return sess.merge (s, o);
    }

    public void persist (final Object o) throws HibernateException {
        sess.persist (o);
    }

    public void persist (final String s, final Object o) throws HibernateException {
        sess.persist (s, o);
    }

    public void delete (final Object o) throws HibernateException {
        sess.delete (o);
    }

    public void delete (final String s, final Object o) throws HibernateException {
        sess.delete (s, o);
    }

    public void lock (final Object o, final LockMode lockMode) throws HibernateException {
        sess.lock (o, lockMode);
    }

    public void lock (final String s, final Object o, final LockMode lockMode) throws HibernateException {
        sess.lock (s, o, lockMode);
    }

    public void refresh (final Object o) throws HibernateException {
        sess.refresh (o);
    }

    public void refresh (final Object o, final LockMode lockMode) throws HibernateException {
        sess.refresh (o, lockMode);
    }

    public LockMode getCurrentLockMode (final Object o) throws HibernateException {
        return sess.getCurrentLockMode (o);
    }

    public Transaction beginTransaction () throws HibernateException {
        return sess.beginTransaction ();
    }

    public Transaction getTransaction () {
        return sess.getTransaction ();
    }

    public Criteria createCriteria (final Class aClass) {
        return sess.createCriteria (aClass);
    }

    public Criteria createCriteria (final Class aClass, final String s) {
        return sess.createCriteria (aClass, s);
    }

    public Criteria createCriteria (final String s) {
        return sess.createCriteria (s);
    }

    public Criteria createCriteria (final String s, final String s1) {
        return sess.createCriteria (s, s1);
    }

    public Query createQuery (final String s) throws HibernateException {
        return sess.createQuery (s);
    }

    public SQLQuery createSQLQuery (final String s) throws HibernateException {
        return sess.createSQLQuery (s);
    }

    public Query createFilter (final Object o, final String s) throws HibernateException {
        return sess.createFilter (o, s);
    }

    public Query getNamedQuery (final String s) throws HibernateException {
        return sess.getNamedQuery (s);
    }

    public void clear () {
        sess.clear ();
    }

    public Object get (final Class aClass, final Serializable serializable) throws HibernateException {
        return sess.get (aClass, serializable);
    }

    public Object get (final Class aClass, final Serializable serializable, final LockMode lockMode) throws HibernateException {
        return sess.get (aClass, serializable, lockMode);
    }

    public Object get (final String s, final Serializable serializable) throws HibernateException {
        return sess.get (s, serializable);
    }

    public Object get (final String s, final Serializable serializable, final LockMode lockMode) throws HibernateException {
        return sess.get (s, serializable, lockMode);
    }

    public String getEntityName (final Object o) throws HibernateException {
        return sess.getEntityName (o);
    }

    public Filter enableFilter (final String s) {
        return sess.enableFilter (s);
    }

    public Filter getEnabledFilter (final String s) {
        return sess.getEnabledFilter (s);
    }

    public void disableFilter (final String s) {
        sess.disableFilter (s);
    }

    public SessionStatistics getStatistics () {
        return sess.getStatistics ();
    }

    public void setReadOnly (final Object o, final boolean b) {
        sess.setReadOnly (o, b);
    }

    public Connection disconnect () throws HibernateException {
        return sess.disconnect ();
    }

    public void reconnect () throws HibernateException {
        sess.reconnect ();
    }

    public void reconnect (final Connection connection) throws HibernateException {
        sess.reconnect (connection);
    }

}
